package com.oa.hyperion.socketServe;

import org.springframework.stereotype.Component;

import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@ServerEndpoint("/v1/Attendance")
@Component
public class AttendanceSocketServer {
    public static Map<Integer, Session> sessions = new ConcurrentHashMap<>();

    @OnOpen
    public void onOpen(Session session) {
        System.out.println("客户端连接");
        sessions.put(1, session);
    }

    @OnMessage
    public void onMessage(String msg,Session session) {
        System.out.println("客户端发来消息:" + msg);
//        Set<Session> openSessions = session.getOpenSessions();
    }
}
